import {LinValidator, Rule} from "lin-mizar";
import { isOptional } from '../libs/util';

class AddContentValidator extends LinValidator {
	constructor() {
		// validator.js
		super();
		// todo list 待完善
		this.image = [
			new Rule('isNotEmepty',  '内容封面不能为空')
		]
		this.type = [
			new Rule('isNotEmepty',  '内容类型不能为空'),
			new Rule('isInt',  '内容类型id必须是数字')
		]
		this.title = [
			new Rule('isNotEmepty',  '内容标题不能为空')
		]
		this.content = [
			new Rule('isNotEmepty',  '内容介绍不能为空')
		]
		this.url = [
			new Rule('isOptional'),
			new Rule ('isURL',  '内容外链必须是合法url')
	]
		this.pubDate = [
			new Rule('isNotEmepty',  '发布日期不能为空')
	]
		this.status = [
			new Rule('isNotEmepty',  '内容有效状态未指定')
	]
	}
}

export { AddContentValidator }
